﻿@{
    
    Layout = "~/Shared/_Layout.cshtml";
    Page.Header = "Directory Search";
    
    string fname = Request["fname"];
    string lname = Request["lname"];
    
    // connect to mysql databse and find the records matching 
    
   // @fname = "bh";
    
   var peopledb = Database.Open("PeopleSoft");
    
   var selectQuery = "SELECT * FROM ndussearch.employees WHERE FIRSTNAME LIKE "  + "'"  + @fname + "%'" + " ORDER BY FIRSTNAME";
    
  
    
    var data  = peopledb.Query(selectQuery);
    
    string space = "";
    
    string facultyImg = "../ImgFolder/BusinessPerson.png";
    string studentImg = "../ImgFolder/StudentPerson.png";
    string ImgName = studentImg;
    
    
}


<div data-role="content" >
    
    <ol data-role="listview" data-theme="d" data-inset="true" data-dividertheme="c"  >
    
             
          @foreach(var row in data) {
            
            
                ImgName = facultyImg;
            
            if(@row.title.ToString().IndexOf("GTA") != -1)
            {
                ImgName = studentImg;
                
                
            }
            
            if (@row.title.ToString().IndexOf("GRA") != -1)
                 {

                    ImgName = studentImg;
                 }

                 if (@row.title.ToString().IndexOf("GSA") != -1)
                 {

                     ImgName = studentImg;
                 }

                 if (@row.title.ToString().IndexOf("Grad Service Assistant") != -1)
                 {

                     ImgName = studentImg;
                 }

                 if (@row.title.ToString().IndexOf("Graduate Teaching Assistant") != -1)
                 {

                     ImgName = studentImg;
                 }
            
           
           <li> <img src= @ImgName class =  "ui-li-icon"/>
                 <a href= "SingleEmployee/@row.emplid">  @row.firstname  @space  @row.lastname </a> <p></p><p class="jobTitleDisplay">@row.title</p>
            
            </li>
            
            
       }  
    
    </ol>
    
    </div>
